import { useNavigation } from '@react-navigation/native';
import React, { useRef } from 'react';
import { TouchableOpacity, ViewProps } from 'react-native';

type DebuggingEntranceButtonProps = {} & ViewProps;

const DebuggingEntranceButton: React.FC<DebuggingEntranceButtonProps> = (
  props
) => {
  const navigation = useNavigation();
  const tapCount = useRef(0);
  return (
    <TouchableOpacity
      className="w-10 h-6"
      onPress={() => {
        tapCount.current += 1;
        if (tapCount.current >= 10) {
          // @ts-ignore
          navigation.navigate('Debugging');
          tapCount.current = 0;
        }
      }}
      {...props}
    />
  );
};

export default React.memo(DebuggingEntranceButton);
